package ddbs;

public class AbsWork {
    static int nextID = 0;
    protected int id;
    private boolean isjobdone = false;
    JobDoneCallback donecb = null;

    public synchronized static int nextID() {
        nextID++;
        return nextID;
    }

    public void generateId() {
        id = nextID();
    }

    int getId() {
        return id;
    }

    boolean IsJobDone() {
        return isjobdone;
    }

    public void jobdonecb(Object obj) {
    }

    protected void handleResponse(MSG msg) {
    }

    synchronized protected void done() {
        isjobdone = true;
        //System.out.println("Work "+this.id+" done");
        if (donecb != null)
            donecb.jobdonecb(this);
    }
}
